from weibosender.weibo.weibo_helper import WeiboHelper


class Main:
    @staticmethod
    def init():
        switch = {
            1: WeiboHelper.gather_user,
            2: Main.send_msg
        }
        while 1:
            cmd = input('请选择要执行的操作：\n1. 采集用户\n2. 发送私信\n\n')
            if not cmd.isdigit():
                print('命令输入有误')
                continue
            cmd = int(cmd)
            if cmd not in switch:
                print('未知命令')
                continue

            switch[cmd]()

    @staticmethod
    def send_msg():
        print('开始登录...')
        user = WeiboHelper.login()
        if user == 0:
            print('登录失败')
            return None
        print('登录完成...')
        WeiboHelper.send_msg()


if __name__ == '__main__':
    Main.init()

    while 1:
        pass

